// ==UserScript==
// @name         微信推文克隆工具
// @namespace    http://szrshhh.com/
// @version      1.0.2
// @description  微信推文克隆工具,仅用于相同主体的不同账号间克隆推文，不同主体的账号，克隆推文请标注转载。免责声明：本脚本仅用于学习交流，请勿用于非法用途。
// @author       白马非马
// @match        *://mp.weixin.qq.com/cgi-bin/appmsg?t=media/appmsg_edit*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=qq.com
// @grant        none
// @license      MIT
// ==/UserScript==

(function () {
  'use strict';
  const app = document.createElement("div"); //外部div
  const copyButton = document.createElement("button"); // 复制该篇推文按钮
  const pasteButton = document.createElement("button"); // 粘贴该篇推文按钮
  const insertButton = document.createElement("button"); // 插入尾缀
  const insertButton2 = document.createElement("button"); // 插入尾缀
  // const test = document.createElement("button");      // 测试按钮
  var titleText1 = '无';
  var titleText2 = "无";

  app.style.backgroundColor = '#dcdfe6';
  app.style.borderRadius = '1em';
  app.style.position = "fixed";

  app.style.top = "100px";
  app.style.right = "100px";
  app.style.width = "130px";
  app.style.height = "270px";

  app.style.padding = "10px";
  app.style.boxSizing = "border-box";

  copyButton.textContent = "1.复制该篇推文";
  copyButton.style.color = '#409eff';
  copyButton.style.border = '0px #c6e2ff solid';
  copyButton.style.backgroundColor = '#ecf5ff';
  copyButton.style.width = '110px';
  copyButton.style.margin = '0 20px 0 0';
  copyButton.style.height = '50px';
  copyButton.style.cursor = 'pointer';
  copyButton.style.borderRadius = '1em';
  copyButton.style.transition = '0.1s';

  copyButton.addEventListener("mousedown", function () { //监听鼠标按下
    this.style.color = '#fff';
    this.style.border = '0px #409eff solid';
    this.style.backgroundColor = '#409eff';
    save();
  });
  copyButton.addEventListener("mouseup", function () { //监听鼠标松开
    this.style.color = '#409eff';
    this.style.border = '0px #c6e2ff solid';
    this.style.backgroundColor = '#ecf5ff';
  });

  pasteButton.textContent = "2.粘贴该篇推文";
  pasteButton.style.color = '#409eff';
  pasteButton.style.border = '0px #c6e2ff solid';
  pasteButton.style.backgroundColor = '#ecf5ff';
  pasteButton.style.width = '110px';
  pasteButton.style.margin = '15px 20px 0 0';
  pasteButton.style.height = '50px';
  pasteButton.style.cursor = 'pointer';
  pasteButton.style.borderRadius = '1em';
  pasteButton.style.transition = '0.1s';

  pasteButton.addEventListener("mousedown", function () { //监听鼠标按下
    this.style.color = '#fff';
    this.style.border = '0px #409eff solid';
    this.style.backgroundColor = '#f78989';
    paste();
  });
  pasteButton.addEventListener("mouseup", function () { //监听鼠标松开
    this.style.color = '#409eff';
    this.style.border = '0px #c6e2ff solid';
    this.style.backgroundColor = '#ecf5ff';
  });
  insertButton.textContent = "4.插入尾缀";
  insertButton.style.color = '#409eff';
  insertButton.style.border = '0px #c6e2ff solid';
  insertButton.style.backgroundColor = '#ecf5ff';
  insertButton.style.width = '110px';
  insertButton.style.margin = '15px 20px 0px 0';
  insertButton.style.height = '50px';
  insertButton.style.cursor = 'pointer';
  insertButton.style.borderRadius = '1em';
  insertButton.style.transition = '0.1s';

  insertButton.addEventListener("mousedown", function () { //监听鼠标按下
    this.style.color = '#fff';
    this.style.border = '0px #409eff solid';
    this.style.backgroundColor = '#f78989';
    inset();
  });
  insertButton.addEventListener("mouseup", function () { //监听鼠标松开
    this.style.color = '#409eff';
    this.style.border = '0px #c6e2ff solid';
    this.style.backgroundColor = '#ecf5ff';
  });
  insertButton2.textContent = "3.插入公众号";
  insertButton2.style.color = '#409eff';
  insertButton2.style.border = '0px #c6e2ff solid';
  insertButton2.style.backgroundColor = '#ecf5ff';
  insertButton2.style.width = '110px';
  insertButton2.style.margin = '15px 20px 0px 0';
  insertButton2.style.height = '50px';
  insertButton2.style.cursor = 'pointer';
  insertButton2.style.borderRadius = '1em';
  insertButton2.style.transition = '0.1s';

  insertButton2.addEventListener("mousedown", function () { //监听鼠标按下
    this.style.color = '#fff';
    this.style.border = '0px #409eff solid';
    this.style.backgroundColor = '#f78989';
    insertgongzhonghao();
  });
  insertButton2.addEventListener("mouseup", function () { //监听鼠标松开
    this.style.color = '#409eff';
    this.style.border = '0px #c6e2ff solid';
    this.style.backgroundColor = '#ecf5ff';
  });

  // test.textContent = "测试";
  // test.style.color = '#409eff';
  // test.style.border = '0px #c6e2ff solid';
  // test.style.backgroundColor = '#ecf5ff';
  // test.style.width = '110px';
  // test.style.margin = '15px 20px 0px 0';
  // test.style.height = '50px';
  // test.style.cursor = 'pointer';
  // test.style.borderRadius = '1em';
  // test.style.transition = '0.1s';

  // test.addEventListener("mousedown", function () {     //监听鼠标按下
  //   this.style.color = '#fff';
  //   this.style.border = '0px #409eff solid';
  //   this.style.backgroundColor = '#f78989';
  // });
  // test.addEventListener("mouseup", function () {     //监听鼠标松开
  //   this.style.color = '#409eff';
  //   this.style.border = '0px #c6e2ff solid';
  //   this.style.backgroundColor = '#ecf5ff';
  // });


  function save() { //复制
    var title = document.getElementsByClassName('js_title_place edui-default');
    titleText1 = title[0].textContent;

    var title2 = document.getElementById("js_description");
    titleText2 = title2.value;

    // console.log("title:"+title[0].textContent);
    // console.log("title2:"+titleText2);
    var iframe = document.getElementById('ueditor_0');
    if (iframe) {
      if (iframe.contentWindow && iframe.contentWindow.document) {
        // 获取iframe中的html文档的完整内容
        var iframeHTML = iframe.contentWindow.document.body.innerHTML;
        var clipboard = new Array;
        clipboard[0] = titleText1;
        clipboard[1] = iframeHTML;
        clipboard[2] = titleText2;
        let arrayString = JSON.stringify(clipboard);
        try {
          navigator.clipboard.writeText(arrayString);
          alert('复制成功');
        } catch (err) {
          alert.error('复制失败', err);
          alert('复制失败');
        }
      } else {
        // iframe可能还没有加载完成，或者由于同源策略无法访问
        alert('iframe未加载完成或无法访问');
      }
    } else {
      alert("没有复制对象");
    }
  }

function paste() {
    if (navigator.clipboard.readText) {
      try {
        var clipboard = navigator.clipboard.readText();
        //clipboard = JSON.parse(clipboard);

        //alert('读取剪切板内容成功');
        //console.log(clipboard.PromiseResult);

          clipboard.then((result) => {
              //console.log("result：", result);
              var jsonData = JSON.parse(result);
              var iframe = document.getElementById('ueditor_0');
              var title = document.getElementById('title');
              var title2 = document.getElementById("js_description");
              if (iframe && title) {
                if (iframe.contentWindow && iframe.contentWindow.document) {
                  // 获取iframe中的html文档的完整内容
                  iframe.contentWindow.document.body.innerHTML = jsonData[1];
                  title.value = jsonData[0];
                  title2.value = jsonData[2];
                  //alert("请在小标题输入一个空格，否则无法保存。")

                } else {
                  // iframe可能还没有加载完成，或者由于同源策略无法访问
                  alert('iframe未加载完成或无法访问');
                }
              } else {
                alert("没有粘贴的位置");
              }
          });
      } catch (err) {
        alert('读取剪切板内容失败:' + err);
      }
    } else {
      alert("剪切板为空");
    }

  };

  function inset() {
    const suffix = `<section style=" margin-bottom: 0px; outline: 0px; font-family: system-ui, -apple-system, BlinkMacSystemFont,'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB','Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px;text-wrap: wrap;font-size: 15px;color: rgb(88, 87, 87);background-color: rgb(255, 255, 255);text-align: center;line-height: 1.75em;">
    <img
      class="rich_pages wxw-img"
      data-fileid="503445794"
      data-imgfileid="100008275"
      data-ratio="0.06388888888888888"
      src="https://mmbiz.qpic.cn/sz_mmbiz_png/RtiaFvgS40GxRUa0she9Utn1tK6HHrbRwEuIBoP09IrdbAIJTCkLHCp2icQcmXic3QMskQBQxZATdJdmhg6sfZm8Q/640?wx_fmt=other&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1&amp;tp=webp"
      data-type="png"
      data-w="1080"
      style="
        outline: 0px;
        vertical-align: middle;
        letter-spacing: 0.544px;
        font-size: 14px;
        border-radius: 8px;
        color: rgb(0, 0, 0);
        display: initial;
        background-size: 16px !important;
        visibility: visible !important;
        width: 544px !important;
      "
      width="544px"
      data-imgqrcoded="1"
    /><br style="outline: 0px" />
  </section>
  <section
    style="
      margin-bottom: 0px;
      outline: 0px;
      letter-spacing: 0.544px;
      text-wrap: wrap;
      font-size: 16px;
      text-align: center;
      font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue',
        'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI',
        'Microsoft YaHei', Arial, sans-serif;
      color: rgb(160, 160, 160);
      background-color: rgb(250, 251, 252);
      line-height: 1.75em;
    "
  >
    <br style="outline: 0px" />
  </section>
  <section
    style="
      margin-bottom: 0px;
      outline: 0px;
      letter-spacing: 0.544px;
      text-wrap: wrap;
      font-size: 16px;
      text-align: center;
      font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue',
        'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI',
        'Microsoft YaHei', Arial, sans-serif;
      color: rgb(160, 160, 160);
      background-color: rgb(250, 251, 252);
      line-height: 1.75em;
    "
  >
    <span style="outline: 0px; font-size: 14px"
      ><strong style="outline: 0px">截止2024年7月，励志阳光</strong
      ><strong style="outline: 0px">心汇心</strong></span
    >
  </section>
  <section
    style="
      margin-bottom: 0px;
      outline: 0px;
      letter-spacing: 0.544px;
      text-wrap: wrap;
      font-size: 16px;
      text-align: center;
      font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue',
        'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI',
        'Microsoft YaHei', Arial, sans-serif;
      color: rgb(160, 160, 160);
      background-color: rgb(250, 251, 252);
      line-height: 1.75em;
    "
  >
    <br style="outline: 0px" />
  </section>
  <section
    style="
      margin-bottom: 0px;
      outline: 0px;
      letter-spacing: 0.544px;
      text-wrap: wrap;
      font-size: 16px;
      text-align: center;
      font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue',
        'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI',
        'Microsoft YaHei', Arial, sans-serif;
      color: rgb(160, 160, 160);
      background-color: rgb(250, 251, 252);
      line-height: 1.75em;
    "
  >
    <span style="outline: 0px; font-size: 14px">已经援助</span
    ><span style="outline: 0px; font-size: 14px; color: rgb(231, 113, 65)"
      ><strong style="outline: 0px">343</strong
      ><strong style="outline: 0px">所</strong></span
    ><span style="outline: 0px; font-size: 14px">经济欠发达地区乡村学校；</span>
  </section>
  <section
    style="
      margin-bottom: 0px;
      outline: 0px;
      letter-spacing: 0.544px;
      text-wrap: wrap;
      font-size: 16px;
      text-align: center;
      font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue',
        'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI',
        'Microsoft YaHei', Arial, sans-serif;
      color: rgb(160, 160, 160);
      background-color: rgb(250, 251, 252);
      line-height: 1.75em;
    "
  >
    <span style="outline: 0px; font-size: 14px">累计捐赠课外图书超过</span
    ><span style="outline: 0px; font-size: 14px; color: rgb(231, 113, 65)"
      ><strong style="outline: 0px">47</strong
      ><strong style="outline: 0px">.5</strong
      ><strong style="outline: 0px">万册</strong></span
    ><span style="outline: 0px; font-size: 14px">；</span>
  </section>
  <section
    style="
      margin-bottom: 0px;
      outline: 0px;
      letter-spacing: 0.544px;
      text-wrap: wrap;
      font-size: 16px;
      text-align: center;
      font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue',
        'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI',
        'Microsoft YaHei', Arial, sans-serif;
      color: rgb(160, 160, 160);
      background-color: rgb(250, 251, 252);
      line-height: 1.75em;
    "
  >
    <span style="outline: 0px; font-size: 14px">累计培训乡村教师</span
    ><span style="outline: 0px; font-size: 14px; color: rgb(231, 113, 65)"
      ><strong style="outline: 0px">近千人次</strong></span
    ><span style="outline: 0px; font-size: 14px">；</span>
  </section>
  <section
    style="
      margin-bottom: 0px;
      outline: 0px;
      letter-spacing: 0.544px;
      text-wrap: wrap;
      font-size: 16px;
      text-align: center;
      font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue',
        'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI',
        'Microsoft YaHei', Arial, sans-serif;
      color: rgb(160, 160, 160);
      background-color: rgb(250, 251, 252);
      line-height: 1.75em;
    "
  >
    <span style="outline: 0px; font-size: 14px">累计受益乡村学生</span
    ><span style="outline: 0px; font-size: 14px; color: rgb(231, 113, 65)"
      ><strong style="outline: 0px">33.3</strong
      ><strong style="outline: 0px">万人次</strong></span
    ><span style="outline: 0px; font-size: 14px">；</span>
  </section>
  <section
    style="
      margin-bottom: 0px;
      outline: 0px;
      letter-spacing: 0.544px;
      text-wrap: wrap;
      font-size: 16px;
      text-align: center;
      font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue',
        'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI',
        'Microsoft YaHei', Arial, sans-serif;
      color: rgb(160, 160, 160);
      background-color: rgb(250, 251, 252);
      line-height: 1.75em;
    "
  >
    <br style="outline: 0px" />
  </section>
  <section
    style="
      margin-bottom: 0px;
      outline: 0px;
      letter-spacing: 0.544px;
      text-wrap: wrap;
      font-size: 16px;
      text-align: center;
      font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue',
        'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI',
        'Microsoft YaHei', Arial, sans-serif;
      color: rgb(160, 160, 160);
      background-color: rgb(250, 251, 252);
      line-height: 1.75em;
    "
  >
    <span style="outline: 0px; font-size: 14px; color: rgb(231, 113, 65)"
      ><strong style="outline: 0px">励志阳光心汇心课堂，</strong></span
    >
  </section>
  <section
    style="
      margin-bottom: 0px;
      outline: 0px;
      letter-spacing: 0.544px;
      text-wrap: wrap;
      font-size: 16px;
      text-align: center;
      font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue',
        'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI',
        'Microsoft YaHei', Arial, sans-serif;
      color: rgb(160, 160, 160);
      background-color: rgb(250, 251, 252);
      line-height: 1.75em;
    "
  >
    <span style="outline: 0px; font-size: 14px; color: rgb(231, 113, 65)"
      ><strong style="outline: 0px">助力30万乡村少年梦想启航！</strong></span
    >
  </section>
  <section
    style="
      margin-bottom: 0px;
      outline: 0px;
      letter-spacing: 0.544px;
      text-wrap: wrap;
      font-size: 16px;
      text-align: center;
      font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue',
        'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI',
        'Microsoft YaHei', Arial, sans-serif;
      color: rgb(160, 160, 160);
      background-color: rgb(250, 251, 252);
      line-height: 1.75em;
    "
  >
    <br style="outline: 0px" />
  </section>
  <section
    data-role="outer"
    label="Powered by 135editor.com"
    style="
      margin-bottom: 0px;
      outline: 0px;
      letter-spacing: 0.544px;
      text-wrap: wrap;
      font-size: 16px;
      background-color: rgb(255, 255, 255);
      text-align: center;
      font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue',
        'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI',
        'Microsoft YaHei', Arial, sans-serif;
      color: rgb(160, 160, 160);
    "
  >
    <section data-tools="135编辑器" data-id="102269" style="outline: 0px">
      <section style="margin: 10px auto; outline: 0px; width: 35px">
        <img
          class="rich_pages wxw-img"
          data-fileid="503445793"
          data-imgfileid="100008276"
          data-ratio="0.8478260869565217"
          src="https://mmbiz.qpic.cn/mmbiz_png/FIBZec7ucCjbMyrVVbbSuuzmpLicF1a2bTOQdicFpLF6rel7tYJgcgaBpLrRujiagyHB0zU3sZYjJb2w7hWquyYbg/640?wx_fmt=other&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1&amp;tp=webp"
          data-type="png"
          data-w="46"
          data-width="100%"
          style="
            outline: 0px;
            border-radius: 8px;
            letter-spacing: 0.544px;
            display: block;
            background-size: 16px !important;
            visibility: visible !important;
            width: 35px !important;
          "
          width="35px"
        />
      </section>
    </section>
  </section>
  <section
    style="
      margin-bottom: 0px;
      outline: 0px;
      letter-spacing: 0.544px;
      text-wrap: wrap;
      font-size: 16px;
      background-color: rgb(255, 255, 255);
      text-align: center;
      font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue',
        'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI',
        'Microsoft YaHei', Arial, sans-serif;
      color: rgb(160, 160, 160);
      line-height: 1.75em;
    "
  >
    <span style="outline: 0px; font-size: 14px; color: rgb(231, 113, 65)"
      ><strong style="outline: 0px">爱心捐款账户</strong></span
    >
  </section>
  <section
    style="
      margin-bottom: 0px;
      outline: 0px;
      letter-spacing: 0.544px;
      text-wrap: wrap;
      font-size: 16px;
      background-color: rgb(255, 255, 255);
      text-align: center;
      font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue',
        'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI',
        'Microsoft YaHei', Arial, sans-serif;
      color: rgb(160, 160, 160);
      line-height: 1.75em;
    "
  >
    <span style="outline: 0px; font-size: 14px"
      >户名：南京励志阳光心汇心公益基金会</span
    >
  </section>
  <section
    style="
      margin-bottom: 0px;
      outline: 0px;
      letter-spacing: 0.544px;
      text-wrap: wrap;
      font-size: 16px;
      background-color: rgb(255, 255, 255);
      text-align: center;
      font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue',
        'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI',
        'Microsoft YaHei', Arial, sans-serif;
      color: rgb(160, 160, 160);
      line-height: 1.75em;
    "
  >
    <span style="outline: 0px; font-size: 14px"
      >开户行：招商银行南京分行长江路支行</span
    >
  </section>
  <section
    style="
      margin-bottom: 0px;
      outline: 0px;
      letter-spacing: 0.544px;
      text-wrap: wrap;
      font-size: 16px;
      background-color: rgb(255, 255, 255);
      text-align: center;
      font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue',
        'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI',
        'Microsoft YaHei', Arial, sans-serif;
      color: rgb(160, 160, 160);
      line-height: 1.75em;
    "
  >
    <span style="outline: 0px; font-size: 14px">账号：125906662310601</span>
  </section>
  <section
    style="
      margin-bottom: 0px;
      outline: 0px;
      font-family: system-ui, -apple-system, BlinkMacSystemFont,
        'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB',
        'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif;
      text-wrap: wrap;
      font-size: 15px;
      color: rgb(88, 87, 87);
      text-align: left;
      background-color: rgb(255, 255, 255);
      letter-spacing: 0.578px;
      line-height: 1.75em;
    "
  >
    <br style="outline: 0px" />
  </section>
  <section
    style="
      margin-bottom: 0px;
      outline: 0px;
      font-family: system-ui, -apple-system, BlinkMacSystemFont,
        'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB',
        'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif;
      letter-spacing: 0.544px;
      text-wrap: wrap;
      font-size: 15px;
      color: rgb(88, 87, 87);
      background-color: rgb(255, 255, 255);
      text-align: center;
      line-height: 1.75em;
    "
  >
    <img
      class="rich_pages wxw-img"
      data-backh="261"
      data-backw="578"
      data-galleryid=""
      data-imgfileid="100008274"
      data-ratio="0.45176110260336905"
      data-s="300,640"
      src="https://mmbiz.qpic.cn/mmbiz_jpg/BTrqekpfbr0ds4lXiaAeLRVFuhLW0AnsliaStwGebgzxRTNMAry2djV7XfVNIoDib4yvgl0gabsf0hItiagR9ZmAibA/640?wx_fmt=other&amp;from=appmsg&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1&amp;tp=webp"
      data-type="jpeg"
      data-w="653"
      style="
        outline: 0px;
        border-radius: 8px;
        background-size: 16px !important;
        visibility: visible !important;
        width: 637px !important;
      "
    />
  </section>
  <section
    powered-by="xiumi.us"
    style="
      margin-bottom: 0px;
      outline: 0px;
      font-family: system-ui, -apple-system, BlinkMacSystemFont,
        'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB',
        'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif;
      font-size: 16px;
      letter-spacing: 0.544px;
      text-wrap: wrap;
      background-color: rgb(255, 255, 255);
      line-height: 1;
    "
  >
    <p style="outline: 0px"><br /></p>
        </section>`
    // console.log(suffix);
    var iframe = document.getElementById('ueditor_0');
    if (iframe) {
      if (iframe.contentWindow && iframe.contentWindow.document) {
        // 获取iframe中的html文档的完整内容
        iframe.contentWindow.document.body.innerHTML += suffix;
      } else {
        // iframe可能还没有加载完成，或者由于同源策略无法访问
        alert('iframe未加载完成或无法访问');
      }
    } else {
      alert("插入失败，请联系管理员");
    }

  }

  function insertgongzhonghao(){
    const gongzhonghao = `<section style="margin-bottom: 0px;outline: 0px;font-family: system-ui, -apple-system, BlinkMacSystemFont,
        'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB',
        'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif;letter-spacing: 0.544px;text-wrap: wrap;font-size: 15px;color: rgb(88, 87, 87);background-color: rgb(255, 255, 255);text-align: center;line-height: 1.75em;"><br></section>
        <section style="margin-bottom: 0px;outline: 0px;font-family: system-ui, -apple-system, BlinkMacSystemFont,
        'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB',
        'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif;letter-spacing: 0.544px;text-wrap: wrap;font-size: 15px;color: rgb(88, 87, 87);background-color: rgb(255, 255, 255);text-align: center;line-height: 1.75em;"><br></section>
        <section style="margin-bottom: 0px;outline: 0px;font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei UI&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;letter-spacing: 0.544px;text-wrap: wrap;font-size: 15px;color: rgb(88, 87, 87);background-color: rgb(255, 255, 255);text-align: center;line-height: 1.75em;"><strong style="outline: 0px;">更多精彩可关注公众号抢先查看<mpchecktext contenteditable="false" id="1722411610951_0.749478613262007"></mpchecktext></strong></section>
        <section class="mp_profile_iframe_wrp custom_select_card_wrp" style="margin-bottom: 0px;outline: 0px;font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei UI&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;letter-spacing: 0.544px;text-wrap: wrap;background-color: rgb(255, 255, 255);"><mp-common-profile class="js_uneditable custom_select_card mp_profile_iframe js_wx_tap_highlight mp_common_widget" data-pluginname="mpprofile" data-id="MzkzNDY5OTY1Nw==" data-headimg="http://mmbiz.qpic.cn/mmbiz_png/NAVa0NtocZ7miazYRRbzgo4phuztkY5XzjhHXCDtGNKjiaibCJDuGvfoWT8iceA33tBrPvJjFibXaFBcFXzUEDYroEQ/300?wx_fmt=png&amp;wxfrom=19" data-nickname="阳光少年养成计划" data-alias="SunshineYouth-2024" data-signature="“阳光少年养成计划”是南京励志阳光心汇心公益基金会开展的公益项目，旨在整合教育资源、发动社会力量，援助建校及小微基建，帮助乡村学生获得优质均衡的教育。搭建各类展示风采的舞台，带领师生走出大山开拓眼界，培养自信开朗、乐学善思的阳光少年。" data-from="2" data-is_biz_ban="0" data-origin_num="4" data-isban="0" data-biz_account_status="0" data-index="0" contenteditable="false"></mp-common-profile></section>
        <section style="margin-bottom: 0px;outline: 0px;font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei UI&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;letter-spacing: 0.544px;text-wrap: wrap;font-size: 15px;color: rgb(88, 87, 87);background-color: rgb(255, 255, 255);text-align: center;line-height: 1.75em;"><br style="outline: 0px;"></section>
        <section style="margin-bottom: 0px;outline: 0px;font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei UI&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;letter-spacing: 0.544px;text-wrap: wrap;font-size: 15px;color: rgb(88, 87, 87);background-color: rgb(255, 255, 255);text-align: center;line-height: 1.75em;"><br style="outline: 0px;letter-spacing: 0.544px;"></section>`;
        var iframe = document.getElementById('ueditor_0');
        if (iframe) {
          if (iframe.contentWindow && iframe.contentWindow.document) {
            // 获取iframe中的html文档的完整内容
            iframe.contentWindow.document.body.innerHTML += gongzhonghao;
          } else {
            // iframe可能还没有加载完成，或者由于同源策略无法访问
            alert('iframe未加载完成或无法访问');
          }
        } else {
          alert("插入失败，请联系管理员");
        }
  }
  app.appendChild(copyButton);
  app.appendChild(pasteButton);

  app.appendChild(insertButton2);
  app.appendChild(insertButton);
  document.body.appendChild(app);



})();